package com.yan.ems.utils;

//import org.apache.commons.csv.CSVFormat;
//import org.apache.commons.csv.CSVParser;
//import org.apache.commons.csv.CSVRecord;
import com.opencsv.CSVParser;
import org.springframework.web.multipart.MultipartFile;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class MultipartCsvProcessor {

//    public static List<List<String>> readCsvFromMultipartFile(MultipartFile file) throws IOException {
//        List<List<String>> data = new ArrayList<>();
//        try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getInputStream()));
//             CSVParser csvParser = new CSVParser(reader, CSVFormat.DEFAULT.withFirstRecordAsHeader())) {
//            for (CSVRecord csvRecord : csvParser) {
//                List<String> row = new ArrayList<>();
//                for (String value : csvRecord) {
//                    row.add(value);
//                }
//                data.add(row);
//            }
//        }
//        return data;
//    }
}    